<?php
/**
 * 集群配置 cluster-enabled yes
 *  port 8100
 *  cluster-enabled yes
 *  cluster-config-file nodes-8000.conf
 *  cluster-node-timeout 5000
 *
 */

// 使用 RedisCluster
$conf = [
    '127.0.0.1:8100',
    '127.0.0.1:8110',
    ];

$redisCluster = new RedisCluster(null, $conf);
//读取数据时,走从库 无法验证
$redisCluster->setOption(RedisCluster::OPT_SLAVE_FAILOVER,RedisCluster::FAILOVER_DISTRIBUTE_SLAVES);
//$data[] = $redisCluster->set('newname', 'PHP litter white');
$data[] = $redisCluster->get('newname');

var_dump($data);